package com.jimmy.medical.entity;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @author jimmy
 * @Description:用户实体
 * @date 2018-04-03
 */
@Entity
@Table(name = "users")
public class User extends AbstractEntity {
    /**
     * 用户名
     */
    @Column(name = "username", length = 20)
    private String username;
    /**
     * 真实姓名
     */
    @Column(name = "realname", length = 50)
    private String realname;
    /**
     * 登录密码
     */
    @Column(name = "passwd", length = 20)
    private String password;
    /**
     * 头像
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "photo_id")
    @NotFound(action = NotFoundAction.IGNORE)
    private UploadFile photo;

    /**
     * 性别
     */
    @Column(name = "sex", length = 2)
    private String sex;
    /**
     * 身份证号
     */
    @Column(name = "id_card", length = 18)
    private String idCard;

    /**所属医院,可为空,只有候诊室的用户才有所属医院*/
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "hospital_id")
    @NotFound(action = NotFoundAction.IGNORE)
    private Hospital hospital;

    /**角色*/
    @Column(name = "role_id")
    private Long roleId;

    /**
     * 邮箱
     */
    @Column(name = "email", length = 100)
    private String email;
    /**
     * 办公电话
     */
    @Column(name = "office_phone", length = 100)
    private String officePhone;
    /**
     * 手机
     */
    @Column(name = "mobile", length = 100)
    private String mobile;
    /**
     * 是否启用
     */
    @Column(name = "is_enabled", length = 2)
    private String isEnabled = "0";
    /**
     * 职务，岗位
     */
    @Column(name = "job", length = 50)
    private String job;
    /**
     * 授权者用户名
     */
    @Column(name = "create_user", length = 50)
    private String createUser;
    /**
     * 创建时间
     */
    @Column(name = "create_time", length = 20)
    private Date createTime;
    /**
     * 单位代码--对应sys_code.code_sort=部门
     */
    @Column(name = "unit_code", length = 20)
    private String unitCode;
    /**
     * 保留字段，用于区分用户身份
     */
    @Column(name = "identity", length = 2)
    private String identity;
    /**
     * 所属城市
     **/
    @Column(name = "city_list", length = 128)
    private String cityList;
    /**
     * 是否在线问诊
     */
    @Column(name = "online_ask", length = 1)
    private String onlineask;
    /**
     * 价格
     */
    @Column(name = "price")
    private BigDecimal price;

    /**
     * 科别(category)
     */
    @Column(name = "category", length = 128)
    private String category;

    /**
     * 职称(title)
     */
    @Column(name = "title_hospital", length = 32)
    private String titleHospital;
    @Column(name = "title", length = 64)
    private String title;

    /**
     * 排班开始时间
     */
    @Column(name = "work_time_st", length = 5)
    private String workTimeSt;
    /**
     * 排班结束时间
     */
    @Column(name = "work_time_end", length = 5)
    private String workTimeEnd;

    /**
     * 医生描述
     */
    @Column(name = "description", length = 255)
    private String description;

    //用于统计，后台定时更新数据
    /**
     * 接单数
     */
    @Column(name = "flow_order_count")
    private Integer flowOrderCount;

    /**
     * 退号数
     */
    @Column(name = "cancel_order_count")
    private Integer cancelOrderCount;

    /**
     * 退单数
     */
    @Column(name = "cancel_flow_order_count")
    private Integer cancelFlowOrderCount;

    /**
     * 超时数
     */
    @Column(name = "over_time_count")
    private Integer overTimeCount;

    /**
     * @return the username
     */
    public String getUsername() {
        return username;
    }


    /**
     * @param username the username to set
     */
    public void setUsername(String username) {
        this.username = username;
    }


    /**
     * @return the realname
     */
    public String getRealname() {
        return realname;
    }


    /**
     * @param realname the realname to set
     */
    public void setRealname(String realname) {
        this.realname = realname;
    }


    /**
     * @return the password
     */
    public String getPassword() {
        return password;
    }


    /**
     * @param password the password to set
     */
    public void setPassword(String password) {
        this.password = password;
    }


    public UploadFile getPhoto() {
        return photo;
    }

    public void setPhoto(UploadFile photo) {
        this.photo = photo;
    }

    /**
     * @return the sex
     */
    public String getSex() {
        return sex;
    }


    /**
     * @param sex the sex to set
     */
    public void setSex(String sex) {
        this.sex = sex;
    }

    /**
     * @return the idcard
     */
    public String getIdCard() {
        return idCard;
    }


    /**
     * @param idCard the idcard to set
     */
    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }


    /**
     * @return the email
     */
    public String getEmail() {
        return email;
    }


    /**
     * @param email the email to set
     */
    public void setEmail(String email) {
        this.email = email;
    }


    /**
     * @return the officePhone
     */
    public String getOfficePhone() {
        return officePhone;
    }


    /**
     * @param officePhone the officePhone to set
     */
    public void setOfficePhone(String officePhone) {
        this.officePhone = officePhone;
    }


    /**
     * @return the mobile
     */
    public String getMobile() {
        return mobile;
    }


    /**
     * @param mobile the mobile to set
     */
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }


    /**
     * @return the isEnabled
     */
    public String getIsEnabled() {
        return isEnabled;
    }

    public String getIsEnabledCn() {
        return isEnabled.equals("Y") ? "已启用" : "已禁用";
    }

    /**
     * @param isEnabled the isEnabled to set
     */
    public void setIsEnabled(String isEnabled) {
        this.isEnabled = isEnabled;
    }


    /**
     * @return the job
     */
    public String getJob() {
        return job;
    }


    /**
     * @param job the job to set
     */
    public void setJob(String job) {
        this.job = job;
    }


    /**
     * @return the createUser
     */
    public String getCreateUser() {
        return createUser;
    }


    /**
     * @param createUser the createUser to set
     */
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }


    /**
     * @return the createTime
     */
    public Date getCreateTime() {
        return createTime;
    }


    /**
     * @param createTime the createTime to set
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * @return the unitCode
     */
    public String getUnitCode() {
        return unitCode;
    }


    /**
     * @param unitCode the unitCode to set
     */
    public void setUnitCode(String unitCode) {
        this.unitCode = unitCode;
    }

    public String getIdentity() {
        return identity;
    }

    public void setIdentity(String identity) {
        this.identity = identity;
    }

    public String getCityList() {
        return cityList;
    }

    public void setCityList(String cityList) {
        this.cityList = cityList;
    }

    public String getOnlineask() {
        return onlineask;
    }

    public void setOnlineask(String onlineask) {
        this.onlineask = onlineask;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getTitleHospital() {
        return titleHospital;
    }

    public void setTitleHospital(String titleHospital) {
        this.titleHospital = titleHospital;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getWorkTimeSt() {
        return workTimeSt;
    }

    public void setWorkTimeSt(String workTimeSt) {
        this.workTimeSt = workTimeSt;
    }

    public String getWorkTimeEnd() {
        return workTimeEnd;
    }

    public void setWorkTimeEnd(String workTimeEnd) {
        this.workTimeEnd = workTimeEnd;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Hospital getHospital() {
        return hospital;
    }

    public void setHospital(Hospital hospital) {
        this.hospital = hospital;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public Integer getFlowOrderCount() {
        return flowOrderCount;
    }

    public void setFlowOrderCount(Integer flowOrderCount) {
        this.flowOrderCount = flowOrderCount;
    }

    public Integer getCancelOrderCount() {
        return cancelOrderCount;
    }

    public void setCancelOrderCount(Integer cancelOrderCount) {
        this.cancelOrderCount = cancelOrderCount;
    }

    public Integer getCancelFlowOrderCount() {
        return cancelFlowOrderCount;
    }

    public void setCancelFlowOrderCount(Integer cancelFlowOrderCount) {
        this.cancelFlowOrderCount = cancelFlowOrderCount;
    }

    public Integer getOverTimeCount() {
        return overTimeCount;
    }

    public void setOverTimeCount(Integer overTimeCount) {
        this.overTimeCount = overTimeCount;
    }
}
